package net.csdra.user.domain;

import com.fasterxml.jackson.annotation.JsonIgnore;
import net.csdra.basis.domain.EntityBase;
import net.csdra.basis.domain.UserBaseInterface;

import javax.persistence.*;
import java.util.List;

/**
 * Created by msf on 2018/1/24.
 * MetaId为所属镇街
 */
@Entity
@Table(indexes = {
        @Index(name = "METAID_ENTITYDELETE_ENABLED_ENTITYORDER", columnList = "META_ID,ENTITY_DELETE,ENABLED,ENTITY_ORDER"),
        @Index(name = "USERNAME_PASSWORD", columnList = "USERNAME,PASSWORD"),
        @Index(name = "USERNAME_TEMPORSRYPWDF", columnList = "USERNAME,TEMPORSRYPWD"),
})
public class User extends EntityBase implements UserBaseInterface {
    @Column(name = "USERNAME", length = 50, unique = true, nullable = false)
    String userName;

    @JsonIgnore
    @Column(name = "PASSWORD", length = 100)
    String password;

    @ElementCollection
    List<String> authoritys;



    //临时密码
    @JsonIgnore
    @Column(name = "TEMPORSRYPWD", length = 100)
    String temporaryPwd;

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public List<String> getAuthoritys() {
        return authoritys;
    }

    public void setAuthoritys(List<String> authoritys) {
        this.authoritys = authoritys;
    }

    public String getTemporaryPwd() {
        return temporaryPwd;
    }

    public void setTemporaryPwd(String temporaryPwd) {
        this.temporaryPwd = temporaryPwd;
    }
}
